
files = [
  'ascii_table.c',
  'assert.c',
  'base85.c',
  'base91.c',
  'bdiff.c',
  #'big.c',
  'binheap.c',
  'bitmap.c',
  'btree.c',
  'buf.c',
  'cache.c',
  'calc.c',
  'chmod.c',
  'constr.c',
  'debruijn.c',
  'des.c',
  'diff.c',
  'event.c',
  'file.c',
  'flist.c',
  'graph.c',
  'hex.c',
  'idpool.c',
  'json_indent.c',
  'lib.c',
  'list.c',
  'log.c',
  'mem.c',
  'name.c',
  'date.c',
  'format.c',
  'pie.c',
  'seven.c',
  'pool.c',
  'print.c',
  'prof.c',
  'punycode.c',
  'qrcode.c',
  'queue.c',
  'asn1.c',
  'astr.c',
  'pkcs7.c',
  'x509.c',
  'ctype.c',
  'randomart.c',
  'range.c',
  'rbtree.c',
  'sandbox.c',
  'signal.c',
  'skiplist.c',
  'slist.c',
  'spaces.c',
  'stack.c',
  'str.c',
  'str_trim.c',
  'strbuf.c',
  'strpool.c',
  'sys.c',
  'syscmd.c',
  'thread.c',
  'thread_sem.c',
  'thread_lock.c',
  'thread_cond.c',
  'thread_pipe.c',
  'tinyrange.c',
  'tree.c',
  'trie.c',
  'r_json.c',
  'ubase64.c',
  'uleb128.c',
  'unum.c',
  'utf8.c',
  'utf16.c',
  'utf32.c',
  'vector.c',
  'w32-sys.c',
  'zip.c',
  'regex/regcomp.c',
  'regex/regexec.c',
  'regex/regerror.c'
]

r_util_deps = [ldl, mth, pth, utl, sdb_dep, zlib_dep]
if host_machine.system().startswith('freebsd')
  # backtrace_symbols_fd requires -lexecinfo
  r_util_deps += [cc.find_library('execinfo')]
endif

r_util = library('r_util', files,
  include_directories: platform_inc,
  c_args: library_cflags,
  dependencies: r_util_deps,
  install: true,
  implicit_include_directories: false,
  soversion: r2_libversion
)

r_util_dep = declare_dependency(link_with: r_util,
                                include_directories: platform_inc)

pkgconfig_mod.generate(
  libraries: [r_util],
  subdirs: 'libr',
  version: r2_version,
  name: 'r_util',
  filebase: 'r_util',
  description: 'radare foundation libraries'
)
